home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-1.iso / games / nerak2.zip / KING.SCR < prev    next >
Text File  |  1994-07-09  |  5KB  |  198 lines

  1. !
  2. ! King Robert's Script.
  3. !
  4. !------------------------------------------------------------------------!
  5. :@TALK ! Talk to the character !
  6. !------------------------------------------------------------------------!
  7.  
  8.   if player.hp = 0 then
  9.     writeln( player.name, " is dead!" );
  10.     STOP;
  11.   endif;
  12.  
  13.   if npc.picture >= 0 then
  14.     viewpcx(npc);
  15.   endif;
  16.  
  17. ! No more quests?
  18.   if npc.v1 = 16 GOTO NOMORE;
  19.  
  20. ! Always talk to the leader of the pack..
  21.   group.current = 0;
  22.  
  23. ! Initialize the first time through..
  24.   if npc.v0 = 0 then
  25.     npc.v0 = 1;  ! We've talked, but no quest is pending..
  26.     npc.v1 = 0;  ! Do quest 0 first.
  27.   else
  28.     if npc.v0 = 2 goto QUEST; ! We already have a quest..
  29.   endif;
  30.  
  31. ! Select the item to be quested..
  32. :LOOP
  33.   setbp( npc, npc.v1 );
  34.   if npc.bp.count = 0 then
  35.     inc( npc.v1 );       ! The slot is empty, check the next one !
  36.     if npc.v1 = 16 
  37.        goto NOMORE;      ! We've got no more quests !
  38.     goto LOOP;
  39.   endif;
  40.  
  41. :START
  42.   writeln( "Are you in need of a quest?" );
  43.  
  44.   L1 = select( "Yes", "No", "Talk", "Bye" );
  45.   ON L1 GOTO QYES, QNO, CHAT, CSTOP;
  46.  
  47. :QYES
  48.   writeln( "I'll pay you ", $npc.bp.value, " if you bring me ", npc.bp.name );
  49.   writeln( "Good luck.." );
  50.   npc.v0 = 2; ! Quest Given
  51.   goto XSTOP;
  52.  
  53. :QNO
  54.   writeln( "Then be on your way please.." );
  55.   goto XSTOP;
  56.  
  57. !
  58. ! We HAVE a quest
  59. !
  60. :QUEST
  61.   setbp( npc, npc.v1 ); ! Select the quest that was given.. !
  62.   writeln( player.name, "! Have you brought me the ", npc.bp.name, "?" );
  63.   voice( "Quest" );
  64.  
  65.   L1 = select( "Yes", "No", "Talk", "Bye" );
  66.   on L1 goto CYES, CNO, CHAT;
  67.   goto CSTOP;
  68.  
  69. :CYES
  70.  
  71. ! Find out WHO has the item
  72.   L2 = find( player, npc.bp.name );
  73.   if L2 < 0 then 
  74.     ! No one, so find out if the object is a person..
  75.     L2 = find( group, npc.bp.name );
  76.     if L2 < 0 goto NOTHERE;
  77.   endif;
  78.  
  79.   group.current = L2;
  80. ! If the player's name matches the backpack name, its a RESCUE !
  81.   if player.name = npc.bp.name then
  82.     writeln( player.name, "! I almost didn't recognize you.." );
  83.     ! 
  84.     ! When the rescued person leaves the party, take the following actions
  85.     !
  86.     player.v1 = 2;              ! 1 when I join the party.  2 on delivery! 
  87.     if( player.text >= 0 ) then
  88.       inc( player.text );       ! Change text block (if any)
  89.     endif;
  90.     if( player.voice >= 0 ) then
  91.       inc( player.voice );      ! Change voice file (if any)
  92.     endif;
  93.     if( player.picture >= 0 ) then
  94.       inc( player.picture );    ! Change picture file (if any)
  95.     endif;
  96.     player.type = CIVILIAN;     ! No longer a prisoner !
  97.     ! Place the player at next to the NPC (quester)
  98.     leave( player.index, npc.x+1, npc.y ); ! Remove from the party
  99.     group.current = 0;
  100.   else
  101.     ! Otherwise, the quested item is in the player's backpack.
  102.     L2 = find( player.bp, npc.bp.name, npc.bp.type );
  103.     if L2 < 0 GOTO NOTHERE;
  104.     vanish( player.bp );
  105.   endif;
  106.  
  107.   npc.v0 = 1;     ! No quest pending, but we already met
  108.   inc(npc.v1);    ! Increment backpack index for next quest (if any)
  109.  
  110.   ! Now give a reward..
  111.   inc( group.gold, npc.bp.value );               ! Pay for it !
  112.   writeln( $npc.bp.value, " is the reward.  Here it is." );
  113.  
  114.   if npc.bp.weight > 0 then
  115.     L4 = npc.bp.weight;                          ! Experience is given here !
  116.   else
  117.     L4 = npc.bp.value / 10 * (random(3)+1) + 1;  ! Give random experience !
  118.   endif;
  119.  
  120. ! Do the whole party..
  121.   foreach player do
  122.     inc( player.exp, L4 );    ! Level promotions are automatic !
  123.   endfor;
  124.  
  125.  viewpcx (  "end.pcx" );
  126.  wait    (   120  );
  127.  readtext(  "end.txt");
  128.  wait (120);
  129.  endgame;
  130.  Stop;
  131.  
  132.   if npc.bp.endgame = END_ON_GIVE then
  133.     if npc.bp.endtext > 0 then
  134.       readtext( npc.bp.endtext );
  135.     endif;
  136.     ENDGAME;
  137.   endif;
  138.  
  139. :CSTOP
  140.   writeln( "May the force be with you." );
  141.   goto XSTOP;
  142.  
  143. :CNO
  144.   writeln( "Why are you back then?" );
  145.   GOTO CHAT1;
  146.  
  147. !
  148. ! Conversation is optional for a quester, but this one likes to chat..
  149. !
  150. :CHAT
  151.   writeln( "What would you like to talk about?" );
  152.  
  153. :CHAT1
  154.   L3 = getstr("Name","Where","Quest","Bye");
  155.  
  156. ! First, see if the keyword typed is in the character's text block !
  157.   if dotext( S0 ) then
  158.     if L3 = 3 goto XSTOP;
  159.     goto CHAT1;
  160.   endif;
  161.  
  162. ! It didn't, so try the predefined ones..
  163.   on L3 goto CName, WHERE, START, CSTOP;
  164.  
  165. ! Nope, try a 'DEFAULT' line
  166.   if not dotext( "DEFAULT" ) then
  167.     writeln( "I don't know anything about that!" );
  168.   endif;
  169.   goto CHAT1;
  170.  
  171. :CName
  172.   writeln( "My name is ", npc.name, "."        );
  173.   GOTO CHAT1;
  174.  
  175. :WHERE
  176.   writeln( "If I knew where, I wouldn't need your services!" );
  177.   GOTO CHAT1;
  178.  
  179. :NOMORE
  180.   writeln( "Sorry, I have no more quests." );
  181.   goto XSTOP;
  182.  
  183. :NOTHERE
  184.   writeln( "You don't have the ", npc.bp.name, " with you." );
  185.   writeln( "Are you sure you found it?" );
  186.   L3 = select( "Yes", "No", "Maybe", "What", "Who", "Ugh..", "Bye" );
  187.   writeln( "Hmm..  Come back when you find it.." );
  188.   goto XSTOP;
  189.  
  190. !-----------------------------------------------------------------!
  191. ! All STOPs now lead here so the screen can be restored if needed !
  192. !-----------------------------------------------------------------!
  193. :XSTOP
  194.   if npc.picture >= 0 then
  195.     paint(window); ! Assumes the picture fits in the window !
  196.   endif;
  197.   STOP;
  198.